﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Interfaces.General_Interfaces;
using Presenters.General_Presenters;
using Views.Status_Views;
using Extenions.General;

namespace Views.General_Views
{
    public partial class JobManagerView : UserControl, IJobManagerView
    {
        JobManagerPresenter presenter = null;

        public JobManagerView()
        {
            InitializeComponent();
            presenter = new JobManagerPresenter(this);
        }

        string IJobManagerView.position
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        string IJobManagerView.speed
        {
            get
            {
                return speed.Text;
            }
            set
            {
                speed.SetTextLabel(String.Format("{0} km/h",value));
            }
        }

        string IJobManagerView.statusGps
        {
            get
            {
                return statusRegister.Text;
            }
            set
            {
                statusRegister.SetTextLabel(value);
            }
        }

        T Interfaces.Inherited_Interfaces.IView.ReturnView<T>()
        {
            return ((T)(object)this);
        }

        void Interfaces.Inherited_Interfaces.ISuccess.ShowSuccess()
        {
            presenter.ShowSuccess(new SuccessView());
        }

        void Interfaces.Inherited_Interfaces.IError.ShowError()
        {
            presenter.ShowError(new ErrorView());
        }

        private void toolStripLabel1_Click(object sender, EventArgs e)
        {
            presenter.StartListening();
        }

        private void toolStripLabel2_Click(object sender, EventArgs e)
        {
            presenter.StopListening();
        }
    }
}
